﻿@model AntUnion.FrameWork.Model.Models.AdminModel
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>@ViewBag.webAfterTitle</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link href="~/layuiadmin/layui/css/layui.css" rel="stylesheet" />
    <link href="~/layuiadmin/style/admin.css" rel="stylesheet" />
    <link href="~/css/iconfont.css" rel="stylesheet" />
    <script src="~/js/CommonHelper.js"></script>
    <script>
        /^http(s*):\/\//.test(location.href) || alert('请先部署到 localhost 下再访问');

        function getUrlParam(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
            var r = window.location.search.substr(1).match(reg);  //匹配目标参数
            if (r != null) return unescape(r[2]); return null; //返回参数值
        }

        function Logout() {
            var language = getUrlParam("language");
            if (language) {
                window.location.href = '/Console/Home/Logout?language=' + language;
            } else {
                window.location.href = '/Console/Home/Logout?language=manage-zh-CN';
            }
        }

    </script>
    <style>
        .layui-side-menu .layui-nav .layui-nav-item a:hover {
            background-color: #1E9FFF;
            color: #ffffff;
            transition: all 0.5s;
        }
    </style>
</head>
<body class="layui-layout-body">
    <div id="LAY_app">
        <div class="layui-layout layui-layout-admin">
            <div class="layui-header">
                <!-- 头部区域 -->
                <ul class="layui-nav layui-layout-left">
                    <li class="layui-nav-item layadmin-flexible" lay-unselect>
                        <a id="flexible" href="javascript:;" layadmin-event="flexible" title="侧边伸缩">
                            <i class="layui-icon layui-icon-shrink-right" id="LAY_app_flexible"></i>
                        </a>
                    </li>
                    <li class="layui-nav-item" lay-unselect>
                        <a id="refresh" href="javascript:;" layadmin-event="refresh" title="刷新">
                            <i class="layui-icon layui-icon-refresh-3"></i>
                        </a>
                    </li>
                </ul>
                <ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right">
                    <li class="layui-nav-item">
                        <button class="layui-btn layui-btn-sm demo-dropdown-base" id="languageSelect">
                            <i class="layui-icon layui-icon-website"></i>
                        </button>
                    </li>
                    <li class="layui-nav-item layui-hide-xs" lay-unselect>
                        <a href="javascript:;" layadmin-event="theme">
                            <i class="layui-icon layui-icon-theme"></i>
                        </a>
                    </li>
                    <li class="layui-nav-item layui-hide-xs" lay-unselect>
                        <a href="javascript:;" layadmin-event="fullscreen">
                            <i class="layui-icon layui-icon-screen-full"></i>
                        </a>
                    </li>
                    <li class="layui-nav-item" lay-unselect>
                        <a href="javascript:;">
                            <cite>@Model.UserName</cite>
                        </a>
                        <dl class="layui-nav-child">
                            <dd><a id="updatePwd" lay-href="/Console/Users/Edit?id=@Model.Id">修改密码</a></dd>
                            <hr>
                            <dd style="text-align: center;"><a id="logOut" href="javascript:Logout();">退出</a></dd>
                        </dl>
                    </li>
                    <li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-unselect>
                        <a href="javascript:;" layadmin-event="more"><i class="layui-icon layui-icon-more-vertical"></i></a>
                    </li>
                </ul>
            </div>
            <!-- 侧边菜单 -->
            <div class="layui-side layui-side-menu">
                <div class="layui-side-scroll">
                    <div class="layui-logo">
                        <img src="@ViewBag.webAfterLogo" style="height: 30px; width:30px;" />
                        <span>@ViewBag.webAfterName</span>
                    </div>
                    <ul class="layui-nav layui-nav-tree" lay-shrink="all" id="LAY-system-side-menu" lay-filter="layadmin-system-side-menu">
                        @if (ViewBag.menus != null)
                        {
                            List<AntUnion.FrameWork.Model.Models.Menu> menus = ViewBag.menus as List<AntUnion.FrameWork.Model.Models.Menu>;
                            if (menus != null && menus.Count > 0)
                            {
                                int i = 0;
                                foreach (AntUnion.FrameWork.Model.Models.Menu menu in menus)
                                {
                                    if (i == 0)
                                    {
                                        <li data-name="@menu.Id" class="layui-nav-item layui-nav-itemed">
                                            <a id="@menu.Remark" href="javascript:;" lay-tips="@menu.Names" lay-direction="2">
                                                <i class="layui-icon @menu.Image">
                                                    @if (menu.children.Sum(k => k.msgCount) > 0)
                                                    {
                                                        <i class="layui-badge-dot" style="right: 12px;"></i>
                                                    }
                                                </i>
                                                <cite>@menu.Names</cite>
                                            </a>
                                            <dl class="layui-nav-child">
                                                @if (menu.children != null && menu.children.Count > 0)
                                                {
                                                    int y = 0;
                                                    foreach (var item in menu.children)
                                                    {
                                                        if (item.children != null && item.children.Count > 0)
                                                        {
                                                            <dd data-name="@item.Id">
                                                                <a id="@item.Remark" lay-level="two" href="javascript:;">
                                                                    <cite>@item.Names</cite>
                                                                    @if (item.children.Sum(k => k.msgCount) > 0)
                                                                    {
                                                                        <i class="layui-badge-dot" style="right: 12px;"></i>
                                                                    }
                                                                </a>
                                                                <dl class="layui-nav-child">
                                                                    @foreach (var itemTo in item.children)
                                                                    {
                                                                        <dd data-name="@itemTo.Id">
                                                                            <a id="@itemTo.Remark" lay-href="@itemTo.Url">
                                                                                @itemTo.Names
                                                                            </a>
                                                                            @if (itemTo.msgCount > 0)
                                                                            {
                                                                                <span class="layui-badge">@itemTo.msgCount</span>
                                                                            }
                                                                        </dd>
                                                                    }
                                                                </dl>
                                                            </dd>
                                                        }
                                                        else
                                                        {
                                                            if (i == 0 && y == 0)
                                                            {
                                                                <dd data-name="@item.Id" class="layui-this">
                                                                    <a id="@item.Remark" lay-href="@item.Url">
                                                                        @item.Names
                                                                    </a>
                                                                    @if (item.msgCount > 0)
                                                                    {
                                                                        <span class="layui-badge">@item.msgCount</span>
                                                                    }
                                                                </dd>
                                                            }
                                                            else
                                                            {
                                                                <dd data-name="@item.Id">
                                                                    <a id="@item.Remark" lay-href="@item.Url">
                                                                        @item.Names
                                                                    </a>
                                                                    @if (item.msgCount > 0)
                                                                    {
                                                                        <span class="layui-badge">@item.msgCount</span>
                                                                    }
                                                                </dd>
                                                            }
                                                        }
                                                        y++;
                                                    }
                                                }
                                            </dl>
                                        </li>
                                    }
                                    else
                                    {
                                        <li data-name="@menu.Id" class="layui-nav-item">
                                            <a id="@menu.Remark" href="javascript:;" lay-tips="@menu.Names" lay-direction="2">
                                                <i class="layui-icon @menu.Image">
                                                    @if (menu.children.Sum(k => k.msgCount) > 0)
                                                    {
                                                        <i class="layui-badge-dot" style="right: 12px;"></i>
                                                    }
                                                </i>
                                                <cite>@menu.Names</cite>
                                            </a>
                                            <dl class="layui-nav-child">
                                                @if (menu.children != null && menu.children.Count > 0)
                                                {
                                                    int y = 0;
                                                    foreach (var item in menu.children)
                                                    {
                                                        if (item.children != null && item.children.Count > 0)
                                                        {
                                                            <dd data-name="@item.Id">
                                                                <a id="@item.Remark" lay-level="two" href="javascript:;">
                                                                    <cite>@item.Names</cite>
                                                                    @if (item.children.Sum(k => k.msgCount) > 0)
                                                                    {
                                                                        <i class="layui-badge-dot" style="right: 12px;"></i>
                                                                    }
                                                                </a>
                                                                <dl class="layui-nav-child">
                                                                    @foreach (var itemTo in item.children)
                                                                    {
                                                                        <dd data-name="@itemTo.Id">
                                                                            <a id="@itemTo.Remark" lay-href="@itemTo.Url">
                                                                                @itemTo.Names
                                                                            </a>
                                                                            @if (itemTo.msgCount > 0)
                                                                            {
                                                                                <span class="layui-badge">@itemTo.msgCount</span>
                                                                            }
                                                                        </dd>
                                                                    }
                                                                </dl>
                                                            </dd>
                                                        }
                                                        else
                                                        {
                                                            if (i == 0 && y == 0)
                                                            {
                                                                <dd data-name="@item.Id" class="layui-this">
                                                                    <a id="@item.Remark" lay-href="@item.Url">
                                                                        @item.Names
                                                                    </a>
                                                                    @if (item.msgCount > 0)
                                                                    {
                                                                        <span class="layui-badge">@item.msgCount</span>
                                                                    }
                                                                </dd>
                                                            }
                                                            else
                                                            {
                                                                <dd data-name="@item.Id">
                                                                    <a id="@item.Remark" lay-href="@item.Url">
                                                                        @item.Names
                                                                    </a>
                                                                    @if (item.msgCount > 0)
                                                                    {
                                                                        <span class="layui-badge">@item.msgCount</span>
                                                                    }
                                                                </dd>
                                                            }
                                                        }
                                                        y++;
                                                    }
                                                }
                                            </dl>
                                        </li>
                                    }
                                    i++;
                                }
                            }
                        }
                        <span class="layui-nav-bar" style="top: 84px; height: 0px; opacity: 0;"></span>
                    </ul>
                </div>
            </div>
            <!-- 页面标签 -->
            <div class="layadmin-pagetabs" id="LAY_app_tabs">
                <div class="layui-icon layadmin-tabs-control layui-icon-prev" layadmin-event="leftPage"></div>
                <div class="layui-icon layadmin-tabs-control layui-icon-next" layadmin-event="rightPage"></div>
                <div class="layui-icon layadmin-tabs-control layui-icon-down">
                    <ul class="layui-nav layadmin-tabs-select" lay-filter="layadmin-pagetabs-nav">
                        <li class="layui-nav-item" lay-unselect>
                            <a href="javascript:;"></a>
                            <dl class="layui-nav-child layui-anim-fadein">
                                <dd layadmin-event="closeThisTabs"><a id="closeThisTabs" href="javascript:;">关闭当前标签页</a></dd>
                                <dd layadmin-event="closeOtherTabs"><a id="closeOtherTabs" href="javascript:;">关闭其它标签页</a></dd>
                                <dd layadmin-event="closeAllTabs"><a id="closeAllTabs" href="javascript:;">关闭全部标签页</a></dd>
                            </dl>
                        </li>
                    </ul>
                </div>
                <div class="layui-tab" lay-allowclose="true" lay-filter="layadmin-layout-tabs">
                    <ul class="layui-tab-title" id="LAY_app_tabsheader">
                        <li lay-id="/Console/CRMAccount/Index" lay-attr="/Console/CRMAccount/Index" class="layui-this"><i class="layui-icon layui-icon-home"></i></li>
                    </ul>
                </div>
            </div>
            <!-- 主体内容 -->
            <div class="layui-body" id="LAY_app_body">
                <div class="layadmin-tabsbody-item layui-show">
                    <iframe src="/Console/CRMAccount/Index" frameborder="0" class="layadmin-iframe" id="iframeMain"></iframe>
                </div>
            </div>
            <!-- 辅助元素，一般用于移动设备下遮罩 -->
            <div class="layadmin-body-shade" layadmin-event="shade"></div>
        </div>
    </div>
    <script src="~/layuiadmin/layui/layui.js"></script>
    <script>
        layui.config({
            base: '../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'notice', 'element', 'dropdown'], function () {
            var $ = layui.$
                , element = layui.element
                , dropdown = layui.dropdown
                , notice = layui.notice;
            top.topElement = element;

            notice.options = {
                closeButton: false,//显示关闭按钮
                debug: false,//启用debug
                positionClass: "toast-top-right",//弹出的位置,
                showDuration: "300",//显示的时间
                hideDuration: "1000",//消失的时间
                timeOut: "0",//停留的时间
                extendedTimeOut: "0",//控制时间
                showEasing: "swing",//显示时的动画缓冲方式
                hideEasing: "linear",//消失时的动画缓冲方式
                iconClass: 'toast-info', // 自定义图标，有内置，如不需要则传空 支持layui内置图标/自定义iconfont类名
                onclick: function () {
                    $("#newaudio")[0].pause();
                    $("#newaudio")[0].currentTime = 0;
                }
            };

            //多语言下拉框
            dropdown.render({
                elem: '#languageSelect', // 绑定元素选择器，此处指向 class 可同时绑定多个元素
                data: [{
                    title: '中文',
                    id: 'manage-zh-CN',
                    href: '?language=manage-zh-CN'
                }, {
                    title: 'English',
                    id: 'manage-en-US',
                    href: '?language=manage-en-US'
                }],
                click: function (obj) {
                    var selectedValue = $(this).val();
                    getLanguages(layui, selectedValue);
                }
            });

            function setStorage(key, value) {
                if (!window.localStorage) {
                    console.log("浏览器不支持localstorage");
                    return false;
                } else {
                    window.localStorage.setItem(key, value);
                    return true;
                }
            } let themeStyle = {
                theme: {
                    color: {
                        logo: "#344058",
                        main: '#344058',
                        selected: '#1E9FFF',
                        header: '',
                        alias: 'ocean-header',
                        index: 0
                    }
                }
            }
            setStorage('layuiAdmin', JSON.stringify(themeStyle));


            var language = getUrlParam("language");
            $(document).ready(function () {
                if (language) {
                    getLanguages(layui, language);
                } else {
                    getLanguages(layui, 'manage-zh-CN');
                }
            });
        });
    </script>
</body>
</html>


